# Maintainer: Marty Plummer (The_NetZ) <ntzrmtthihu777 (at) gmail (dot) com>

_realname=SDL_gfx
pkgbase=mingw-w64-${_realname}
pkgname=${MINGW_PACKAGE_PREFIX}-${_realname}
pkgver=2.0.26
pkgrel=1
pkgdesc="SDL Graphic Primitives (mingw-w64)"
arch=('any')
url="https://www.ferzkopp.net/joomla/software-mainmenu-14/4-ferzkopps-linux-software/19-sdlgfx"
license=('LGPL')
depends=("${MINGW_PACKAGE_PREFIX}-SDL")
makedepends=("${MINGW_PACKAGE_PREFIX}-gcc" "${MINGW_PACKAGE_PREFIX}-pkg-config")
source=("https://www.ferzkopp.net/Software/SDL_gfx-2.0/${_realname}-${pkgver}.tar.gz")
sha256sums=('7ceb4ffb6fc63ffba5f1290572db43d74386cd0781c123bc912da50d34945446')

prepare() {
  cd ${_realname}-${pkgver}
  autoreconf -fiv
}

build() {
  [[ -d "${srcdir}/build-${MINGW_CHOST}" ]] && rm -rf "${srcdir}/build-${MINGW_CHOST}"
  mkdir -p "${srcdir}/build-${MINGW_CHOST}"
  cd "${srcdir}/build-${MINGW_CHOST}"
  ../${_realname}-${pkgver}/configure \
    --prefix=${MINGW_PREFIX} \
    --build=${MINGW_CHOST} \
    --host=${MINGW_CHOST} \
    --enable-shared \
    --enable-static

  make
}

package() {
  cd "${srcdir}/build-${MINGW_CHOST}"

  make DESTDIR="${pkgdir}" install
  install -Dm644 "${srcdir}/${_realname}-${pkgver}/COPYING" \
    "${pkgdir}${MINGW_PREFIX}/share/licenses/${_realname}/LICENSE"
}
